package edu.ynu.se.xiecheng.achitectureclass.nongye.service;

import edu.ynu.se.xiecheng.achitectureclass.nongye.dao.DeviceDAO;
import edu.ynu.se.xiecheng.achitectureclass.nongye.entity.Device;
import edu.ynu.se.xiecheng.achitectureclass.common.service.LogicService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceService extends LogicService<DeviceDAO, Device, String> {

    public DeviceService(DeviceDAO deviceDAO) {
        super(deviceDAO);
    }

    // 根据大棚ID查询设备
    public List<Device> getDevicesByGreenhouseId(String greenhouseId) {
        return getDAO().findAllByGreenhouseId(greenhouseId);
    }

    // 根据设备序列号查询设备
    public Device getDeviceByBoxId(String boxId) {
        return getDAO().findByBoxId(boxId);
    }
}
